package com.sanjiahantang.youjiaclient.module.me.require.models.impl;

import android.content.Context;

import com.sanjiahantang.youjiaclient.base.CallBack;
import com.sanjiahantang.youjiaclient.config.ConfigValue;
import com.sanjiahantang.youjiaclient.http.BaseDelegate;
import com.sanjiahantang.youjiaclient.http.OkHttpClientManager;
import com.sanjiahantang.youjiaclient.module.me.require.beans.BidDesignerBean;
import com.sanjiahantang.youjiaclient.module.me.require.beans.RequireListBean;
import com.sanjiahantang.youjiaclient.module.me.require.models.IRequireModel;
import com.squareup.okhttp.Request;

import java.util.Map;

/**
 * Created by zy on 2017/10/24.
 */

public class RequireModel implements IRequireModel {
    @Override
    public void loadRequireList(final Context context, Map<String, Object> param, final CallBack<RequireListBean> callBack) {
        OkHttpClientManager.postJson(context, ConfigValue.API_URL + "/user/phone/require/searchUserRequireInfoPhone",
                param,new BaseDelegate.ResultCallback<RequireListBean>() {

                    @Override
                    public void onError(Request request, Object tag, Exception e) {
                        callBack.onFailure(e.getMessage());
                    }

                    @Override
                    public void onResponse(RequireListBean response, Object tag) {
                        callBack.onSuccess(response,context, tag);
                    }
                });
    }
  //支付
    @Override
    public void PayMyOrderRequire(final Context context, Object param, final CallBack<RequireListBean> callBack) {
        OkHttpClientManager.postJson(context, ConfigValue.API_URL + "/order/phone/payServiceOrderPhone",
                param,new BaseDelegate.ResultCallback<RequireListBean>() {

                    @Override
                    public void onError(Request request, Object tag, Exception e) {
                        callBack.onFailure(e.getMessage());
                    }

                    @Override
                    public void onResponse(RequireListBean response, Object tag) {
                        callBack.onSuccess(response,context, tag);
                    }
                });
    }

    @Override
    public void findRequireBidInfoForCustomer(final Context context, Map<String, String> param, final CallBack<BidDesignerBean> callBack) {
        OkHttpClientManager.postAsyn(context, ConfigValue.API_URL + "/user/phone/customerRequireBid/findRequireBidInfoForCustomer",
                param,new BaseDelegate.ResultCallback<BidDesignerBean>() {

                    @Override
                    public void onError(Request request, Object tag, Exception e) {
                        callBack.onFailure(e.getMessage());
                    }

                    @Override
                    public void onResponse(BidDesignerBean response, Object tag) {
                        callBack.onSuccess(response,context, tag);
                    }
                });
    }


}
